package car4u;

public class Alternative {
	
	public enum Type{
		MAKSIMUM,
		SUM,
		T_CONORM
	}
	
	private Type type;
	
	public Alternative(Type type) {
		this.type = type;
	}
	
	public double getAlternative(double x, double y){
		switch(type){
			case MAKSIMUM:
				return getMaksimum(x, y);
			
			case SUM:
				return getSum(x, y);
				
			case T_CONORM:
				return getTConorm(x, y);
		}
		return 0;		
	}

	private double getMaksimum(double x, double y){
		return Math.max(x, y);
	}
	

	private double getSum(double x, double y){
		return x+y-x*y;
	}
	

	private double getTConorm(double x, double y){
		return Math.min(1, x+y);
	}
	
}
